#ifndef __POSTDATA_QT_H__
#define __POSTDATA_QT_H__
#include "cJSON.h"
#include "MQTTClient.h"
#include "shmem.h"
#include "msg_queue_peer.h"
#include "list.h"
#include <sqlite3.h>


#define DEVNUM 13
#define CONFIG_PATH "../config/config.json"

// #define ADDRESS "tcp://localhost:1883"
#define CLIENTID "qtPostData"
#define TOPIC_SE "getData"
#define TOPIC_RC "putData"
#define QOS 1
#define TIMEOUT 10000L

union val_t
{ 
    int b_val;  //bool类型存储空间
    int i_val;   //整形值存储空间
    float f_val;  //浮点值存储空间
};
struct std_node
{
	int key;  //唯一键值
	int type;  //数据点类型
    int dev_type;  //数据点属于哪个设备，根据网关支持的设备自行定义
	union val_t old_val;  //变化上报后需要更新旧值
    union val_t new_val;  //从共享内存取出最新数据，放到new_val中
    int ret;  //默认为-1，采集成功后设置为0，采集失败再置-1
};

//消息队列
struct msg
{
    long type;
    char buf[256];
};

//内核链表
struct keyFromJson
{
    int key;
    int type;
    struct list_head list;
};


#endif